package com.sali.a_pre_knowledge.lesson_lsp.lession_02;


import lombok.extern.slf4j.Slf4j;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * @description: 里氏替换原则--父类起到职责分担的作用，帮助子类做一些事情
 * @date: 2022/11/5 11:52.
 * @version: 1.0
 */
@Slf4j
public abstract class AbstractBankCard {

    // 公共属性
    private String cardNo;
    private String cardDate;

    public AbstractBankCard(String cardNo, String cardDate) {
        this.cardNo = cardNo;
        this.cardDate = cardDate;
    }

    protected abstract boolean rule(BigDecimal amount);

    /**
     * 提现
     *
     * @param orderId
     * @param amount
     * @return
     */
    protected abstract String handleGet(String orderId, BigDecimal amount);


    /**
     * 储蓄
     *
     * @param orderId
     * @param amount
     * @return
     */
    protected abstract String handlePut(String orderId, BigDecimal amount);


    /**
     * description: 入款
     *
     * @author: zhang hang
     **/
    public String putMoney(String orderId, BigDecimal amount) {
        log.info("卡号:{},入款成功，单号:{},金额：{}", cardNo, orderId, amount);
        return "0000";
    }

    /**
     * description: 取款
     *
     * @author: zhang hang
     **/
    public String getMoney(String orderId, BigDecimal amount) {
        log.info("卡号:{},取款成功，单号:{},金额：{}", cardNo, orderId, amount);
        return "0000";
    }

    public List<String> printlnFlow() {
        List<String> lists = new ArrayList<>();
        lists.add("120000");
        lists.add("1120000");
        lists.add("220000");
        lists.add("320000");
        return lists;
    }


    public String getCardNo() {
        return cardNo;
    }

    public String getCardDate() {
        return cardDate;
    }

}
